package com.yoyo.ad.main;

import android.app.Activity;
import android.content.Context;

import com.yoyo.ad.api.ApiManage;
import com.yoyo.ad.confusion.AdManage;
import com.yoyo.ad.confusion.TTAdManagerHolder;
import com.yoyo.ad.contract.AdContract;
import com.yoyo.ad.presenter.AdPresenter;
import com.yoyo.ad.utils.GreenDaoManager;
import com.yoyo.yoyoplat.sdk.YYSdk;

public class YoYoAdManager {

    /**
     * 初始化SDK
     */
    public static void init(Context context) {
        ApiManage.getInstance().init(context);
        TTAdManagerHolder.init(context);
        YYSdk.getInstance().init(context);
//        AdView.setAppSid(context, BAIDU_APP_ID);
//        AppActivity.setActionBarColorTheme(AppActivity.ActionBarColorTheme.ACTION_BAR_WHITE_THEME);
        //GreenDao的初始化
        GreenDaoManager.getInstance().init(context);
    }

    /**
     * 获取广告配置
     */
    public static void getConfig(Context context, AdContract.View adView) {
        new AdPresenter(context, adView).qryAdConfigList();
    }

    public static IAdFactory getAdFactory(Context context, IAdView adView) {
        return AdManage.newInstance(context, adView, context instanceof Activity ? TTAdManagerHolder.create(context) : null);
    }

    public static IAdFactory getAdFactory(Context context, IAdBannerListener adView) {
        return AdManage.newInstance(context, adView, context instanceof Activity ? TTAdManagerHolder.create(context) : null);
    }

    public static IAdFactory getAdFactory(Context context, IAdInteractionListener adView) {
        return AdManage.newInstance(context, adView, context instanceof Activity ? TTAdManagerHolder.create(context) : null);
    }

}
